#ifndef	__DEMO_ACTOR_MANAGER_H__
#define	__DEMO_ACTOR_MANAGER_H__

#include"DEMORenderComponent.h"
#include<vector>

using namespace std;

extern class DEMORenderComponent;

class DEMORenderComponentManger
{
private:
	static	DEMORenderComponentManger			*_mngInstance;

	DEMORenderComponentManger()
	{

	}

	~DEMORenderComponentManger()
	{
	}

	vector<DEMORenderComponent*>		_actorList;
	bool isActorInList(DEMORenderComponent* theActor);
	bool isShouldHeartBeat(float deltaTime);

	
	void insertComponentToList(DEMORenderComponent* theComp);
	void removeComponentFromList(DEMORenderComponent* theComp);

public:
	static DEMORenderComponentManger* getRenderComponentManager()
	{
		if( _mngInstance == NULL)
		{
			_mngInstance = new DEMORenderComponentManger();
		}

		return _mngInstance;
	}

	/**
		We use static function as GC function .
		We must call this function after game loop end.
		Otherwise there will be memory leak.
	*/
	static void gc()
	{
		if( _mngInstance == NULL )
		{
			delete _mngInstance;
			_mngInstance = NULL;
		}
	}

	void tick(float deltaTime);
	void render();

	void registComponent(DEMORenderComponent* theComp);
	void unregistComponent(DEMORenderComponent* theComp);
};
#endif	//__DEMO_ACTOR_MANAGER_H__